﻿#region 头注释
/******************************************************************************
文件名称    :   SurgeryKidneyService.cs
创建日期    :   2011/5/13 6:50:33
功能描述    :   SurgeryKidney实体数据服务类
修改日志    :   
    2011-05-13 06:50  <马利>
*******************************************************************************/
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using Stone.Components.Entities;
using Dare.Utilities.Data;
using Stone.Data.Providers;

namespace Stone.Services.EntityServices
{
    /// <summary>
    /// SurgeryKidney实体数据服务类
    /// </summary>
    public class SurgeryKidneyService : EntityServiceTemplate<SurgeryKidney, long, SurgeryKidneyDataProvider>
    {
        public SurgeryKidneyService(Application app)
            : base(app)
        {
        }

        public bool DeleteSurgeryKidneyInfo(SurgeryKidney kidney)
        {
            MediaFileService mediaFileService = Stone.Services.Application.Instance.GetDbService<MediaFileService>();

            try
            {
                if (kidney.SurgeryRecordFileId.HasValue) mediaFileService.Delete(kidney.SurgeryRecordFileId.Value);
                if (kidney.DSARecordFileId.HasValue) mediaFileService.Delete(kidney.DSARecordFileId.Value);

                return Delete(kidney.Id);
            }
            catch
            {
                return false;
            }
        }

    }
}
